package com.shenmazong.serveredustudent.controller;

import com.shenmazong.serveredustudent.pojo.TbArrangement;
import com.shenmazong.serveredustudent.pojo.TbClazz;
import com.shenmazong.serveredustudent.service.TbArrangementService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.ListParamVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 满天星斗
 * @version 1.0
 * @description: TODO
 * @date 2021/9/26 14:09
 */

@RestController
@RequestMapping("/arrangement")
public class ArrangementController {

    @Autowired
    private TbArrangementService arrangementService;

    /**
     * @description saveArrangement
            * @params [arrangement]
            * @return com.shenmazong.utils.ResultResponse
            * @author S1763
            * @date 2021/9/26 14:12
            */
    //班级课程安排新增
    @PostMapping("/saveArrangement")
    public ResultResponse saveArrangement(@RequestBody TbArrangement arrangement){
        arrangementService.save(arrangement);
        return ResultResponse.SUCCESS("班级课程安排添加成功");
    }

    /**
     * @description deleteArrangement
            * @params [arrangement]
            * @return com.shenmazong.utils.ResultResponse
            * @author S1763
            * @date 2021/9/26 14:13
            */
    //班级课程安排删除
    @PostMapping("/deleteArrangement")
    public ResultResponse deleteArrangement(@RequestBody TbArrangement arrangement){
        arrangementService.removeById(arrangement.getArrangementId());
        return ResultResponse.SUCCESS("班级课程安排删除成功");
    }

    /**
     * @description updateArrangement
            * @params [arrangement]
            * @return com.shenmazong.utils.ResultResponse
            * @author S1763
            * @date 2021/9/26 14:14
            */
    //班级课程安排修改成功
    @PostMapping("/updateArrangement")
    public ResultResponse updateArrangement(@RequestBody TbArrangement arrangement){
        arrangementService.updateById(arrangement);
        return ResultResponse.SUCCESS("班级课程安排修改成功");
    }


    /**
     * @description getAllArrangementByClazzId
            * @params [clazz]
            * @return com.shenmazong.utils.ResultResponse
            * @author S1763
            * @date 2021/9/26 14:24
            */
    //查询班级对应所有课程安排
    @PostMapping("/getAllArrangementByClazzId")
    public ResultResponse getAllArrangementByClazzId(@RequestBody TbClazz clazz){
        return arrangementService.getAllArrangementByClazzId(clazz);
    }

}
